{include file='common/head' /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>店铺-商家-配置</legend>
                </fieldset>
                <form class="layui-form">
                    <input type="hidden" name="type" value="shopOrderConfig">
                    {volist name="viewData" id="v"}
                    <!--                    {$v.title}-->
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            {$v.title}
                        </label>
                        <div class="layui-col-md3">
                            <input type="{$v.type}" name="{$v.key}" required="" autocomplete="off" class="layui-input" value="{$config[$v['key']]|default=$v.default}">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            {$v.desc}
                        </div>
                    </div>
                    <hr>
                    {/volist}
                    <div class="layui-form-item">
                        <label class="layui-form-label"></label>
                        <button class="layui-btn" lay-filter="add" lay-submit="">确定保存</button></div>
                </form>
            </div>
        </div>
        <script>
            layui.use(['form', 'layer','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;
                //监听提交
                form.on('submit(add)', function(data) {
                    $.ajax({
                        url:"/admin/shop/config",
                        type: "post",
                        data:data.field,
                        dataType:"json",
                        success:function (res) {
                            if(res.code == 200){
                                layer.alert(res.msg, {icon:1,time:1000});
                            }else{
                                layer.alert(res.msg, {icon:2,time:1000});
                            }
                        },
                        error:function(e){
                            layer.alert("网络错误", {icon:5,time:1000});
                        },
                    });
                    return false;
                });

            });
        </script>
{include file='common/footer' /}